package com.ostrich.cloud.ostrichBusinessWeb.client;

import com.ostrich.cloud.common.result.PageResult;
import com.ostrich.cloud.common.result.Result;
import com.ostrich.cloud.ostrichBusinessWeb.client.param.*;
import com.ostrich.cloud.ostrichGoodsSercice.model.Dto.GoodsDto;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.AddTypeParam;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.CreateGoodsParam;
import com.ostrich.cloud.ostrichGoodsSercice.model.param.PutTypeParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* name是项目名，contextId是client的名字
*/
@FeignClient(contextId = "goodsWebClient",name="ostrichBusinessWeb")
@Api("商家管理商品接口")
public interface GoodsWebClient {

    @PostMapping("createGoods")
    @ApiOperation("商家添加商品接口")
    public Result createGoods(@RequestBody CreateGoodsParam param);


    @PutMapping("putGood")
    @ApiOperation("商家修改商品接口")
    public Result putGoods(@RequestBody ManagerGoodsParam param);

    @DeleteMapping("delGood")
    @ApiOperation("商家删除商品接口")
    public Result delGoods(@RequestParam("goodsId")Integer goodsId);

    @GetMapping("getDto")
    @ApiOperation("商家查看商家详细信息接口")
    public GoodsDto getGoodsDto(@RequestParam("goodsId") Integer goodsId);

    @PostMapping("allGood")
    @ApiOperation("商家分页查询商品接口")
    public PageResult<GoodsDto> getAllGoods(@RequestBody GetGoodsByBusinessParam param);

    @PostMapping("typeSelect")
    @ApiOperation("商家根据分类查询商品接口")
    public PageResult<GoodsDto> typeSelectGoods(@RequestBody GetGoodsByTypeIdParam param);

    @PostMapping("statusSelect")
    @ApiOperation("商家根据状态查询商品接口")
    public PageResult<GoodsDto> statusSelectGoods(@RequestBody GetGoodsByStatusParam param);

    @PostMapping("linkeNameGoods")
    @ApiOperation("商家根据商品名模糊查询商品接口")
    public PageResult<GoodsDto> linkeNameGoods(@RequestBody GetGoodsLikeNameParam param);


    @PutMapping("takeDownGoods")
    @ApiOperation("上架下架商品接口")
    public Result takeDownGoods(@RequestBody @Valid TakeDownGoodsParam param);

    @PostMapping("addType")
    @ApiOperation("添加商品分类")
    public Result addType(@RequestBody @Valid AddTypeParam param);

    @DeleteMapping("delType")
    @ApiOperation("删除商品接口")
    public Result delType(@RequestParam("typeId")Integer typeId);


    @PutMapping("putType")
    @ApiOperation("修改商品分类接口")
    public Result putType(@RequestBody @Valid PutTypeParam putTypeParam);


    @PostMapping("likeNameType")
    @ApiOperation("根据姓名模糊查询分类接口")
    public Result likeNameType(@RequestBody @Valid GetTypeLikeNameParam param);

    @PostMapping("typeParentId")
    @ApiOperation("根据商品分类父级查询")
    public Result typeParentIdGetType(@RequestBody @Valid GetTypeByParentIdParam parentIdParam);





}
